***************
*** PYRAMID ***
***************

	*** Full sample
		use "$output/coefficients.dta", clear
		local type = "base" 
		local data = "pwt" 
		local minperiod = 1 
		drop if startyear < 1960
		foreach data in pwt wdi mad {
			tw (sc startyear endyear if measure == "`data'" & period >=`minperiod' & beta > .0035 , msize(medsmall) mfcolor("5 48 97") mlcolor(black) mlwidth(vthin)) ///
							(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta < .0035 & beta > .0025, msize(medsmall) mfcolor("33 102 172") mlcolor(black) mlwidth(vthin)) ///
							(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta < .0025 & beta > .0015, msize(medsmall) mfcolor("67 147 195") mlcolor(black) mlwidth(vthin)) ///
							(sc startyear endyear if measure == "`data'" & period >=`minperiod' & beta < .0015 & beta > .0005, msize(medsmall) mfcolor("146 197 222") mlcolor(black) mlwidth(vthin)) ///
							(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta < .0005 & beta > -.0005, msize(medsmall) mfcolor("209 229 240") mlcolor(black) mlwidth(vthin)) ///
							(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta > -.0015 & beta < -.0005, msize(medsmall) mfcolor("247 247 247") mlcolor(black) mlwidth(vthin)) ///
							(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta > -.0025 & beta < -.0015, msize(medsmall) mfcolor("253 219 199") mlcolor(black) mlwidth(vthin)) ///
							(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta > -.0035 & beta < -.0025, msize(medsmall) mfcolor("244 165 130") mlcolor(black) mlwidth(vthin)) ///
							(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta > -.0045 & beta < -.0035, msize(medsmall) mfcolor("214 96 77") mlcolor(black) mlwidth(vthin)) ///
							(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta > -.0055 & beta < -.0045, msize(medsmall) mfcolor("178 24 43") mlcolor(black) mlwidth(vthin)) ///
							(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta < -.0055, msize(medsmall) mfcolor("103 0 31") mlcolor(black) mlwidth(vthin)) ///
							, plotregion(style(none) lcolor(none)) ///
							graphregion(fcol(white) lcol(white)) ///
							xtitle("End Year") ytitle("Start Year") ///
								 aspectratio(1) xlabel(1960(10)2010) ylabel(1960(10)2010) xsize(1) ysize(1) ///
							legend(order(1 ">.0035" 2 "[.0025, .0035]" 3 "[.0015, .0025]"  4 "[.0005, .0015]"  5 "[-.0005, .0005]"  6 "[-.0015, -.0005]"  7 "[-.0025, -.0015]"  8 "[-.0035, -.0025]"  9 "[-.0045, -.0035]"  10 "[-.0055, -.0045]"  11 "<-.0055"  ) size(small) pos(10) ring(0) bmargin(medsmall) col(1) region(lcolor(none) fcolor(none))) 
							
			graph export "$figures/`data'_coeftr_heatmap_`type'_full.pdf", replace	
		}
		
	*** Fixed sample 
		use "$output/coefficients_constsamp.dta", clear
		local type = "constsamp" 
		local data = "pwt" 
		local minperiod = 1 
		drop if startyear < 1960
		tw (sc startyear endyear if measure == "`data'" & period >=`minperiod' & beta > .0035 , msize(medlarge) mfcolor("5 48 97") mlcolor(black) mlwidth(vthin)) ///
						(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta < .0035 & beta > .0025, msize(medlarge) mfcolor("33 102 172") mlcolor(black) mlwidth(vthin)) ///
						(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta < .0025 & beta > .0015, msize(medlarge) mfcolor("67 147 195") mlcolor(black) mlwidth(vthin)) ///
						(sc startyear endyear if measure == "`data'" & period >=`minperiod' & beta < .0015 & beta > .0005, msize(medlarge) mfcolor("146 197 222") mlcolor(black) mlwidth(vthin)) ///
						(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta < .0005 & beta > -.0005, msize(medlarge) mfcolor("209 229 240") mlcolor(black) mlwidth(vthin)) ///
						(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta > -.0015 & beta < -.0005, msize(medlarge) mfcolor("247 247 247") mlcolor(black) mlwidth(vthin)) ///
						(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta > -.0025 & beta < -.0015, msize(medlarge) mfcolor("253 219 199") mlcolor(black) mlwidth(vthin)) ///
						(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta > -.0035 & beta < -.0025, msize(medlarge) mfcolor("244 165 130") mlcolor(black) mlwidth(vthin)) ///
						(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta > -.0045 & beta < -.0035, msize(medlarge) mfcolor("214 96 77") mlcolor(black) mlwidth(vthin)) ///
						(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta > -.0055 & beta < -.0045, msize(medlarge) mfcolor("178 24 43") mlcolor(black) mlwidth(vthin)) ///
						(sc startyear endyear if measure == "`data'" & period >=`minperiod'  & beta < -.0055, msize(medlarge) mfcolor("103 0 31") mlcolor(black) mlwidth(vthin)) ///
						, plotregion(style(none) lcolor(none)) ///
						graphregion(fcol(white) lcol(white)) ///
						xtitle("End Year") ytitle("Start Year") ///
							 aspectratio(1) xlabel(1980(10)2010) ylabel(1980(10)2010) xsize(1) ysize(1) ///
						legend(order(1 ">.0035" 2 "[.0025, .0035]" 3 "[.0015, .0025]"  4 "[.0005, .0015]"  5 "[-.0005, .0005]"  6 "[-.0015, -.0005]"  7 "[-.0025, -.0015]"  8 "[-.0035, -.0025]"  9 "[-.0045, -.0035]"  10 "[-.0055, -.0045]"  11 "<-.0055") size(small) pos(10) ring(0) bmargin(medsmall) col(1) region(lcolor(none) fcolor(none))) 
		graph export "$figures/`data'_coef_heatmap_`type'_full.pdf", replace